const path = require("path");
const webpack = require("webpack");
module.exports = {
    entry:"./src/index.js",
    // mode: "development",
    devServer: {
        contentBase: "./dist",
        hot: true
    },
    externals:{
        jquery: 'jQuery'
    },
    module: {
        rules: [
            {
                test: /\.js$/,
                    exclude: /(node_modules)/,
                        use: {
                            loader: 'babel-loader',
                                options: {
                                    presets: ['@babel/preset-env']
                                }
                }
            },
            {
                test:/\.scss$/,
                use:['style-loader','css-loader',
                {
                    loader: 'postcss-loader',
                    options: {
                        ident: 'postcss',//设置惟一标识
                        plugins: loader => [
                            require("autoprefixer")({ browsers: ['>0.15% in CN'] }) //添加前缀,根据浏览器版本
                        ]
                    }
                },
                'sass-loader']
            }
        ]
    },
    plugins: [
        new webpack.BannerPlugin("yfbanner v1.0.0\n author:yifeng \n createTime:2019")
    ],
    output: {
        filename: "yfbanner.js",
        path: path.resolve(__dirname,"dist"),
        library:"mybanner",
        libraryTarget:"umd"
    },
}